package com.xgpro.domain.rolemanage.entity;

import lombok.Data;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

/**
 * @program: xgpro__dev
 * @Description: 权限
 * @Author: wangyang
 * @Date: 2019-09-15 09:55
 **/
@Data
@Table(name = "t_permissions")
public class Permissions implements Serializable {

    @Id
    @KeySql(useGeneratedKeys = true)
    private Integer id;

    /**
     * 权限名称
     */
    private String permissionsName;

    /**
     * 权限类型
     */
    private String type;

    /**
     * 权限描述
     */
    private String description;

    /**
     * 权限代码
     */
    private String code;

    /**
     * 父权限
     */
    private Integer pid;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Permissions that = (Permissions) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(permissionsName, that.permissionsName) &&
                Objects.equals(type, that.type) &&
                Objects.equals(description, that.description) &&
                Objects.equals(code, that.code) &&
                Objects.equals(pid, that.pid);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, permissionsName, type, description, code, pid);
    }
}